<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户表单页面</title>
    <link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">

    <script src="../../js/jquery-3.4.1.js"></script>
    <script src="../../js/layui/layui.js" charset="utf-8"></script>

</head>
<body>


    <div id="updateReload">
        <div id="updateOperation">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>用户信息维护</legend>
            </fieldset>
            <form id="updateMess" class="layui-form" action="" method="post" >
                <input type="hidden" name="userId" id="userId" >

                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" id="userName" lay-verify="required"  class="layui-input" style="width:280px;">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="userPwd" id="userPwd" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input" style="width:280px;">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>

                    <div class="layui-input-block">
                        <input type="text" name="userPhone" id="userPhone" lay-verify="required" maxlength="11" placeholder="请输入手机号" autocomplete="off"  class="layui-input" style="width:280px;">
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="submit" lay-submit="" lay-filter="update" id="update" class="layui-btn"  value="提交">
                        <input id="closeUpdate" type="button" class="layui-btn layui-btn-primary" value="取消">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>

        layui.use(['form',  'layer','transfer'], function() {
                var layer = layui.layer //弹层
                , form = layui.form
                ,transfer = layui.transfer;
                form.on('submit(update)', function (data) {
                    console.info(data.field);
                    var url ="../../verycdUser/insertOrUpdate" ;
                    var dataParam = data.field ;

                    $.post(url,dataParam,function(resp){

                        if(resp.state==1){
                            parent.layui.table.reload("idTest");
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.layer.msg(resp.msg);


                        }
                    },"JSON")

                    return false ;

                });
            }
        );
    </script>
</body>
</html>